/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package entity;

import java.io.Serializable;
import java.util.List;
import javax.persistence.Basic;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlTransient;

/**
 *
 * @author atap
 */
@Entity
@Table(name = "tag", catalog = "spring2013g1", schema = "")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "Tag.findAll", query = "SELECT t FROM Tag t"),
    @NamedQuery(name = "Tag.findById", query = "SELECT t FROM Tag t WHERE t.id = :id"),
    @NamedQuery(name = "Tag.findByTagName", query = "SELECT t FROM Tag t WHERE t.tagName = :tagName"),
    @NamedQuery(name = "Tag.findByDescription", query = "SELECT t FROM Tag t WHERE t.description = :description"),
    @NamedQuery(name = "Tag.findBySynnId", query = "SELECT t FROM Tag t WHERE t.synnId = :synnId")})
public class Tag implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Basic(optional = false)
    @Column(name = "Id")
    private Integer id;
    @Column(name = "TagName")
    private String tagName;
    @Column(name = "Description")
    private String description;
    @Column(name = "SynnId")
    private Integer synnId;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "tagId")
    private List<Coursetag> coursetagList;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "referencedTagId")
    private List<Tagcorrelations> tagcorrelationsList;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "mainTagId")
    private List<Tagcorrelations> tagcorrelationsList1;

    public Tag() {
    }

    public Tag(Integer id) {
        this.id = id;
    }

    public Integer getId() {
        return id;
    }

    public void setId(Integer id) {
        this.id = id;
    }

    public String getTagName() {
        return tagName;
    }

    public void setTagName(String tagName) {
        this.tagName = tagName;
    }

    public String getDescription() {
        return description;
    }

    public void setDescription(String description) {
        this.description = description;
    }

    public Integer getSynnId() {
        return synnId;
    }

    public void setSynnId(Integer synnId) {
        this.synnId = synnId;
    }

    @XmlTransient
    public List<Coursetag> getCoursetagList() {
        return coursetagList;
    }

    public void setCoursetagList(List<Coursetag> coursetagList) {
        this.coursetagList = coursetagList;
    }

    @XmlTransient
    public List<Tagcorrelations> getTagcorrelationsList() {
        return tagcorrelationsList;
    }

    public void setTagcorrelationsList(List<Tagcorrelations> tagcorrelationsList) {
        this.tagcorrelationsList = tagcorrelationsList;
    }

    @XmlTransient
    public List<Tagcorrelations> getTagcorrelationsList1() {
        return tagcorrelationsList1;
    }

    public void setTagcorrelationsList1(List<Tagcorrelations> tagcorrelationsList1) {
        this.tagcorrelationsList1 = tagcorrelationsList1;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (id != null ? id.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Tag)) {
            return false;
        }
        Tag other = (Tag) object;
        if ((this.id == null && other.id != null) || (this.id != null && !this.id.equals(other.id))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "entity.Tag[ id=" + id + " ]";
    }
    
}
